<%if session[:admin]%>
<h1>Listing users</h1>

<table>
  <tr>
    <th>Loginname</th>
    <th>Username</th>
    <th>Contactnumber</th>
    <th>Address</th>
    <th>Emailid</th>
  </tr>

<% @users.each do |user| %>
  <tr>
    <td><%=h user.name %></td>
    <td><%=h user.userName %></td>
    <td><%=h user.contactNumber %></td>
    <td><%=h user.address %></td>
    <td><%=h user.emailId %></td>
    <td><%= link_to 'Show', user %></td>
    <td><%= link_to 'Edit', edit_user_path(user) %></td>
	<%if user.name != "admin" %>
    <td><%= link_to 'Destroy', user, :confirm => 'Are you sure?', :method => :delete %></td>
	<% end %>
	
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New user', new_user_path %>
<%if session[:admin]%>
